'''
Created on 04/09/2010

@author: lctr30
'''
import pygtk
pygtk.require('2.0')
import gtk


class Table(gtk.Table):


    def __init__(self):
        gtk.Table.__init__(self, homogeneous=False)
        self.curr_right = 0
        self.curr_bottom = 0
        self.curr_left = 0
        self.curr_top = 0
        self.xpadding = 0
        self.ypadding = 0
        self.xoptions = gtk.EXPAND | gtk.FILL
        self.yoptions = gtk.EXPAND | gtk.FILL
        
        
    def set_xpadding(self, xpadding):
        self.xpadding = xpadding
        
    def set_ypadding(self, ypadding):
        self.ypadding = ypadding
        
    def set_padding(self, padding):
        self.xpadding = padding
        self.ypadding = padding
        
    def set_xoptions(self, xoptions):
        self.xoptions = xoptions
        
    def set_yoptions(self, yoptions):
        self.yoptions = yoptions
        
    def set_options(self, options):
        self.xoptions = options
        self.yoptions = options
        
    def attach_down(self, widget, vsize=1, hsize=1):
   
        if (self.curr_right == 0):
            self.curr_right = hsize
        
        self.curr_top = self.curr_bottom
        self.curr_bottom = self.curr_bottom + hsize
        
        self.resize(self.curr_right, self.curr_bottom)
            
        print self.curr_left, self.curr_right, self.curr_top, self.curr_bottom
        
        self.attach(widget, self.curr_left, self.curr_right, self.curr_top, self.curr_bottom, self.xoptions, self.yoptions, self.xpadding, self.ypadding)

        
    def attach_right(self, widget, vsize=1, hsize=1):
        
        if (self.curr_bottom == 0):
            self.curr_bottom = vsize
        
        self.curr_left = self.curr_right
        self.curr_right = self.curr_right + vsize
        
        self.resize(self.curr_right, self.curr_bottom)
            
        print self.curr_left, self.curr_right, self.curr_top, self.curr_bottom

        self.attach(widget, self.curr_left, self.curr_right, self.curr_top, self.curr_bottom, self.xoptions, self.yoptions, self.xpadding, self.ypadding)

        

        
        
    